home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Interfaces & Libraries / Interfaces / PInterfaces / GXMath.p < prev    next >
Encoding:
Text File  |  1995-07-06  |  5.0 KB  |  137 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        GXMath.p
  3.  
  4.      Contains:    QuickDraw GX math routine interfaces.
  5.  
  6.      Version:    Technology:    Quickdraw GX 1.1
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. }
  19.  
  20. {$IFC UNDEFINED UsingIncludes}
  21. {$SETC UsingIncludes := 0}
  22. {$ENDC}
  23.  
  24. {$IFC NOT UsingIncludes}
  25.  UNIT GXMath;
  26.  INTERFACE
  27. {$ENDC}
  28.  
  29. {$IFC UNDEFINED __GXMATH__}
  30. {$SETC __GXMATH__ := 1}
  31.  
  32. {$I+}
  33. {$SETC GXMathIncludes := UsingIncludes}
  34. {$SETC UsingIncludes := 1}
  35.  
  36.  
  37. {$IFC UNDEFINED __CONDITIONALMACROS__}
  38. {$I ConditionalMacros.p}
  39. {$ENDC}
  40.  
  41. {$IFC UNDEFINED __TYPES__}
  42. {$I Types.p}
  43. {$ENDC}
  44.  
  45. {$IFC UNDEFINED __FIXMATH__}
  46. {$I FixMath.p}
  47. {$ENDC}
  48.  
  49. {$PUSH}
  50. {$ALIGN MAC68K}
  51. {$LibExport+}
  52. {$SETC mathTypesIncludes := 1}
  53.  
  54. TYPE
  55.     gxPoint = RECORD
  56.         x:                        Fixed;
  57.         y:                        Fixed;
  58.     END;
  59.  
  60.     gxColorValue = INTEGER;
  61.  
  62.     gxPolar = RECORD
  63.         radius:                    Fixed;
  64.         angle:                    Fixed;
  65.     END;
  66.  
  67.     gxMapping = RECORD
  68.         map:                    ARRAY [0..2,0..2] OF Fixed;
  69.     END;
  70.  
  71.  
  72. CONST
  73.     gxColorValue1                = $0000FFFF;                    { gxColorValue 1.0 }
  74.  
  75.     gxPositiveInfinity            = $7FFFFFFF;                    { for Fixed and Fract }
  76.     gxNegativeInfinity            = $80000000;                    { for Fixed and Fract }
  77.  
  78. {$SETC mathRoutinesIncludes := 1}
  79.  
  80. FUNCTION CopyToMapping(VAR target: gxMapping; {CONST}VAR source: gxMapping): gxMapping; C;
  81. FUNCTION InvertMapping(VAR target: gxMapping; {CONST}VAR source: gxMapping): gxMapping; C;
  82. FUNCTION MapMapping(VAR target: gxMapping; {CONST}VAR source: gxMapping): gxMapping; C;
  83. FUNCTION MoveMapping(VAR target: gxMapping; hOffset: Fixed; vOffset: Fixed): gxMapping; C;
  84. FUNCTION MoveMappingTo(VAR target: gxMapping; hPosition: Fixed; vPosition: Fixed): gxMapping; C;
  85. FUNCTION NormalizeMapping(VAR target: gxMapping): gxMapping; C;
  86. FUNCTION RotateMapping(VAR target: gxMapping; angle: Fixed; xCenter: Fixed; yCenter: Fixed): gxMapping; C;
  87. FUNCTION ScaleMapping(VAR target: gxMapping; hFactor: Fixed; vFactor: Fixed; xCenter: Fixed; yCenter: Fixed): gxMapping; C;
  88. FUNCTION ResetMapping(VAR target: gxMapping): gxMapping; C;
  89. FUNCTION SkewMapping(VAR target: gxMapping; skewX: Fixed; skewY: Fixed; xCenter: Fixed; yCenter: Fixed): gxMapping; C;
  90. PROCEDURE MapPoints({CONST}VAR source: gxMapping; count: LONGINT; vector: gxPoint); C;
  91. FUNCTION FirstBit(x: LONGINT): INTEGER; C;
  92. FUNCTION WideScale({CONST}VAR source: wide): INTEGER; C;
  93. FUNCTION LinearRoot(first: Fixed; last: Fixed; t: Fract): INTEGER; C;
  94. FUNCTION QuadraticRoot(first: Fixed; control: Fixed; last: Fixed; t: Fract): INTEGER; C;
  95. FUNCTION PolarToPoint({CONST}VAR ra: gxPolar; VAR xy: gxPoint): gxPoint; C;
  96. FUNCTION PointToPolar({CONST}VAR xy: gxPoint; VAR ra: gxPolar): gxPolar; C;
  97. FUNCTION FractCubeRoot(source: Fract): Fract; C;
  98. FUNCTION FractDivide(dividend: Fract; divisor: Fract): Fract; C;
  99. FUNCTION FractMultiply(multiplicand: Fract; multiplier: Fract): Fract; C;
  100. FUNCTION FractSineCosine(degrees: Fixed; VAR cosine: Fract): Fract; C;
  101. FUNCTION FractSquareRoot(source: Fract): Fract; C;
  102. FUNCTION FixedDivide(dividend: Fixed; divisor: Fixed): Fixed; C;
  103. FUNCTION FixedMultiply(multiplicand: Fixed; multiplier: Fixed): Fixed; C;
  104. { This next call is (source * multiplier / divisor) -- it avoids underflow, overflow by using wides }
  105. FUNCTION MultiplyDivide(source: LONGINT; multiplier: LONGINT; divisor: LONGINT): LONGINT; C;
  106. FUNCTION Magnitude(deltaX: LONGINT; deltaY: LONGINT): LONGINT; C;
  107. FUNCTION VectorMultiplyDivide(count: LONGINT; {CONST}VAR vector1: LONGINT; step1: LONGINT; {CONST}VAR vector2: LONGINT; step2: LONGINT; divisor: LONGINT): LONGINT; C;
  108. { wide operations are defined within FixMath.h only for PowerPC }
  109. {$IFC NOT GENERATINGPOWERPC }
  110. FUNCTION WideAdd(VAR target: wide; {CONST}VAR source: wide): wide; C;
  111. FUNCTION WideCompare({CONST}VAR target: wide; {CONST}VAR source: wide): INTEGER; C;
  112. FUNCTION WideNegate(VAR target: wide): wide; C;
  113. FUNCTION WideShift(VAR target: wide; shift: LONGINT): wide; C;
  114. FUNCTION WideSquareRoot({CONST}VAR source: wide): LONGINT; C;
  115. FUNCTION WideSubtract(VAR target: wide; {CONST}VAR source: wide): wide; C;
  116. FUNCTION WideMultiply(multiplicand: LONGINT; multiplier: LONGINT; VAR target: wide): wide; C;
  117. { returns the quotient }
  118. FUNCTION WideDivide({CONST}VAR dividend: wide; divisor: LONGINT; VAR remainder: LONGINT): LONGINT; C;
  119. { quotient replaces dividend }
  120. FUNCTION WideWideDivide(VAR dividend: wide; divisor: LONGINT; VAR remainder: LONGINT): wide; C;
  121. {$ENDC}
  122. FUNCTION VectorMultiply(count: LONGINT; {CONST}VAR vector1: LONGINT; step1: LONGINT; {CONST}VAR vector2: LONGINT; step2: LONGINT; VAR dot: wide): wide; C;
  123. FUNCTION RandomBits(count: LONGINT; focus: LONGINT): LONGINT; C;
  124. PROCEDURE SetRandomSeed({CONST}VAR seed: wide); C;
  125. FUNCTION GetRandomSeed(VAR seed: wide): wide; C;
  126.  
  127. {$ALIGN RESET}
  128. {$POP}
  129.  
  130. {$SETC UsingIncludes := GXMathIncludes}
  131.  
  132. {$ENDC} {__GXMATH__}
  133.  
  134. {$IFC NOT UsingIncludes}
  135.  END.
  136. {$ENDC}
  137.